<template>
	<view ref="child">
		<slot></slot>
	</view>
</template>

<script>
	export default {
		name: "CustomGroup",
		props: ['whole'],
		provide() {
			return {
				handleParentMethod: this.handleParentMethod,
				whole: true,
			};
		},
		data() {
			return {
			};
		},
		methods: {
			/**
			 * 获取所有数据
			 * @param {Object} state
			 * @param {Object} value
			 */
			handleParentMethod(state, value) {
				// if (state === true) {
				// 	this.valueList.push(value)
				// } else {
				// 	this.valueList = this.valueList.filter(item => item !== value);
				// }
				// console.log(this.valueList)
				this.$nextTick(()=>{
					const child = this.$children;
					const list = [];
					for(let i=0;i<child.length;i++){
						if(child[i].checkState===true){
							list.push(child[i].value)
						}
					}
					this.$emit("change",list)
				})
			}
		}
	}
</script>

<style>

</style>